<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0043)./UserList.html -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>
	榆林科技馆内容页
</title><link rel="stylesheet" type="text/css" href="./css/reset.css">
<link rel="stylesheet" type="text/css" href="./css/main.css">
    <script type="text/javascript" src="./js/adddate.js"></script>
    <script type="text/javascript" src="./js/vue2.min.js"></script>
    <script type="text/javascript" src="./js/axios.min.js"></script>
</head>
<body>
    <form name="form1" method="post" action="./UserList.html" id="form1">


<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>



    <div class="main_box">
        <div class="side_here">
            <p>
                <a href="./UserList.html#" title="首页"></a>当前位置 &gt; <span>系统设置</span> &gt; <span>
                    系统用户</span></p>
        </div>
        <div id="div1">
        <!--公用位置导航结束-->
        <div class="cont_box">
            <p class="title_bt">
                系统用户信息查询</p>
            <table class="table_list1" border="0" cellspacing="0" cellpadding="0">
                <tbody>
                    <tr>
                        <td class="name">
                            用户名：
                        </td>
                        <td class="enter3">
                            <input name="txtA_user" v-model="condition.userName" type="text" id="txtA_user" class="input">
                        </td>
                        <td class="name">
                            注册日期：
                        </td>
                        <td class="enter3">
                            <input name="txtA_addtime" v-model="condition.createTime" id="txtA_addtime" type="text" class="timeimg" onclick="SelectDate(this,&#39;yyyy-MM-dd&#39;)" size="10" style="width: 150px;">
                        </td>
                        <td class="name">
                            所属角色：
                        </td>
                        <td class="enter3">
                            <select name="ddlA_post" v-model="condition.role" id="ddlA_post">
                                <option v-for="r in roles" :value="r.roleID">{{r.roleName}}</option>

</select>
                        </td>
                        <td>
                            <input type="button" name="Button1" @click="search()" value="查询" id="Button1" class="chaxun">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <!--表格选项-->
        <div class="cont_box">
            <p class="title_bt">
                系统用户信息列表
                   <input type="button" @click="goAdd()" name="Button2" value="新增" id="Button2" class="chaxun">
                    </p>
            <table width="1060" border="0" cellpadding="0" cellspacing="0" class="table_list2">
                <tbody><tr>
                    <th width="4%">
                        序号
                    </th>
                    <th width="8%">
                        用户名
                    </th>
                    <th width="11%">
                        姓名
                    </th>
                    <th width="11%">
                        注册日期
                    </th>
                    <th width="12%">
                        所属角色
                    </th>
                    <th width="13%">
                        操作
                    </th>
                </tr>
                
                        <tr v-for="user in user">
                            <td>
                                {{user.usID}}
                            </td>
                            <td>
                                {{user.userName}}
                            </td>
                            <td>
                                {{user.realName}}
                            </td>
                            <td>
                                {{user.createTime}}
                            </td>
                            <td>
                                {{user.roleName}}
                            </td>
                            <td>
                                <input type="button" name="Repeater1$ctl00$btnEdit" value="" id="Repeater1_ctl00_btnEdit" @click="updateUser(user.usID)"  title="编辑" class="btn btn_an btn_config">
                                <input type="submit" name="Repeater1$ctl00$btndel" value="" id="Repeater1_ctl00_btndel" @click="del(user.usID)" title="删除" class="btn btn_an btn_del">
                            </td>
                    
                        </tr></tbody></table>
        <!--页码开始-->
            <div class="pages" style="margin-top: 40px;">
                <ul class="yema">
                    <li style="border-left: none;">
                        <a id="Lbthead" class="pagebtn" href="javascript:__doPostBack(&#39;Lbthead&#39;,&#39;&#39;)">首页</a></li>
                    <li>
                        <a id="Lbtpre" class="pagebtn" href="javascript:__doPostBack(&#39;Lbtpre&#39;,&#39;&#39;)">上一页</a></li>
                    <li>
                        <a id="Lbtnext" class="pagebtn" href="javascript:__doPostBack(&#39;Lbtnext&#39;,&#39;&#39;)">下一页</a></li>
                    <li>
                        <a id="Lbtend" class="pagebtn" href="javascript:__doPostBack(&#39;Lbtend&#39;,&#39;&#39;)">尾页</a></li>
                    <div class="clear">
                    </div>
                </ul>
                <div class="searchPage">
                    <span class="page-sum">共<strong class="allPage">&nbsp;1
                    </strong>页</span>&nbsp;<span class="page-sum">第<strong class="allPage">&nbsp;1
                    </strong>页</span> <span class="page-go">跳转第
                        <input name="Txtpageno" type="text" id="Txtpageno" class="pagebtn" size="3" onkeyup="this.value=this.value.replace(/[^\d\.]/g, &#39;&#39;)" style="ime-mode: disabled">页</span>
                    <a id="BtngoPage" class="page-btn" href="javascript:__doPostBack(&#39;BtngoPage&#39;,&#39;&#39;)">GO</a>
                </div>
            </div>
        </div>
    </div>
    </div>
   
    <!--页码结束-->
    <!--按钮元素-->
    </form>
<script>
    var divAdd = new Vue({
       el:'#div1',
       data:{
           condition:{
           },
            user:[
            ],
           roles:[
           ]
       },
       methods: {
           goAdd: function () {
               window.location.href = "AddUser.html?"
           },
           search: function () {
               var url = "/user?action=search&userName="+divAdd.condition.userName+"&createTime="+divAdd.condition.createTime+"&role="+divAdd.condition.role;
               alert(url);
               axios.get(url)
                   .then(res => {
                       divAdd.user = res.data;
                   });
           },
           del:function (usID){   //删除
               if (window.confirm("您确定要删除吗?"+usID)){
                   var url="../user?action=deleteUser&usID="+usID;
                   axios.get(url).then(res=>{
                       if (res.data=="success"){  //如果后端删除成功的话 返回success，前端再对应id进行删除
                           //遍历结果集
                           for (var i=0;i<divAdd.user.length;i++){
                               if (divAdd.user[i].usID==usID){
                                   //数组.splice(要删除的对象的下标，删除的数量)
                                   divAdd.user.splice(i,1);
                               }
                           }
                       }
                   });
               }
           },
           updateUser:function (usID){
               window.location.href="/sys/updateUser.html?usID="+usID
           }
       }
    });
    window.onload=init;
    function init(){
        var url = "/user?action=findAll";
        axios.get(url)
            .then(res=>{
                divAdd.user=res.data;
            });
        var url1 = "/user?action=findRoles"
        axios.get(url).then(res=>{
            divAdd.roles=res.data;
        });
    }
</script>

</body></html>